<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
	
    <h:body>	
    	<ui:composition template="/user/template.xhtml">
    		<div class="novinka prvni">
                <h1>Delegace</h1> 
                <c:forEach  var="competion" items="#{delegationBean.competionList}"  >
                 	<h2>#{competion.name}</h2>
                 	<table style="margin-top:5px;text-align: left; font-size: 10px;">
		                  <tr>
		                  	  <th>kod</th>
		                  	  <th> datum</th>
		                      <th style="text-align:left">&nbsp;Domácí</th>
		                      <th style="text-align:left">Hlavní r</th>
		                      <th style="text-align:left">AR1</th>
		                      <th style="text-align:left">DS</th>
		                      <th style="text-align:left">poznámka</th>
		                  </tr>
		                  <tr>
		                  	  <th></th>
		                      <th>den - čas</th>
		                      <th style="text-align:left">&nbsp;Hosté</th>
		                      <th style="text-align:left"></th>
		                      <th style="text-align:left">AR2</th>
		                      <th style="text-align:left">Spolujízda</th>
		                      <th></th>
		                  </tr>
	                 	 <c:forEach var="player" items="#{delegationBean.matchList}"  >
			                 <c:if test="#{competion.name eq player.competion.name}">   
			                    <tr class="suda">
			                      <td style="font-size: 9px;width: 10%;"><b>#{player.matchCode}</b></td>
			                      <td style="font-size: 9px;width: 15%;"><b><h:outputText value="#{player.datum} " escape="false"/></b></td>
			                      <td style="width: 15%;" class="jmeno2">&nbsp;#{player.homeTeam.frontName}</td>
			                      <td style="width: 15%;" ><h:outputText value="#{player.mainReferee}" escape="false"/></td>
			                      <td style="width: 15%;" ><h:outputText value="#{player.lineReferee}" escape="false"/></td>
			                      <td style="width: 15%;" ><h:outputText value="#{player.delegat}" escape="false"/></td>
			                      <td style="width: 15%;" rowspan="2"><h:outputText value="#{player.poznamka}" escape="false"/></td>
			                    </tr>
			                    <tr class="suda">
			                      <td></td>
			                      <td style="font-size: 9px;width: 10%;">
			                      <b>
			                      <script language="JavaScript" type="text/javascript">
									date='#{player.datum}';
									splitdate=date.split('.');
									
									datum = new Date();
									datum.setFullYear(splitdate[2]);
									datum.setMonth(splitdate[1]-1);
									datum.setDate(splitdate[0]);
									
									dayAsWord = new Array("NE", "PO", "UT", "ST", "CT", "PA", "SO");
									document.write(dayAsWord[datum.getDay()]);
									</script>
			                      <h:outputText value=" - #{player.start}" escape="false"/></b></td>
			                      
			                      <td style="width: 30%;">&nbsp;#{player.awayTeam.frontName}</td>
			                      <td style="width: 20%;"></td>
			                      <td style="width: 20%;"><h:outputText value="#{player.lineRefereeTwo}" escape="false"/></td>
			                      <td style="width: 20%;"><h:outputText value="#{player.spolujizda}" escape="false"/></td>
			                    </tr> 
			                      <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
			                    <tr>
			                    </tr>
			                 </c:if>                    	 	                 	 
	                 	 </c:forEach>
                 	 </table>
                </c:forEach>
                
                <c:forEach  var="delegation" items="#{delegationBean.delegationczech}"  >
                 	<h2>#{delegation.competion}</h2>
                 	<table style="margin-top:5px;text-align: left; font-size: 10px;">
		                  <tr>
		                  	  <th>kod</th>
		                  	  <th> datum</th>
		                      <th style="text-align:left">&nbsp;Domácí</th>
		                      <th style="text-align:left">Hlavní r</th>
		                      <th style="text-align:left">AR1</th>
		                      <th style="text-align:left">DS</th>
		                      <th style="text-align:left">poznámka</th>
		                  </tr>
		                  <tr>
		                  	  <th></th>
		                      <th>den - čas</th>
		                      <th style="text-align:left">&nbsp;Hosté</th>
		                      <th style="text-align:left"></th>
		                      <th style="text-align:left">AR2</th>
		                      <th style="text-align:left">Spolujízda</th>
		                      <th></th>
		                  </tr>
	                 	        <tr class="suda">
			                      <td style="font-size: 9px;width: 10%;"><b></b></td>
			                      <td style="font-size: 9px;width: 15%;"><b><h:outputText value="#{delegation.date} " escape="false"/></b></td>
			                      <td style="width: 15%;" class="jmeno2">&nbsp;#{delegation.homeTeam}</td>
			                      <td style="width: 15%;" ><h:outputText value="#{delegation.mainReferee}" escape="false"/></td>
			                      <td style="width: 15%;" ><h:outputText value="#{delegation.lineRefereeOne}" escape="false"/></td>
			                      <td style="width: 15%;" ><h:outputText value="#{delegation.ds}" escape="false"/></td>
			                      <td style="width: 15%;" rowspan="2"><h:outputText value="#{delegation.note}" escape="false"/></td>
			                    </tr>
			                    <tr class="suda">
			                      <td></td>
			                      <td style="font-size: 9px;width: 10%;">
			                      <b>
			                      <script language="JavaScript" type="text/javascript">
									date='#{delegation.date}';
									splitdate=date.split('.');
									
									datum = new Date();
									datum.setFullYear(splitdate[2]);
									datum.setMonth(splitdate[1]-1);
									datum.setDate(splitdate[0]);
									
									dayAsWord = new Array("NE", "PO", "UT", "ST", "CT", "PA", "SO");
									document.write(dayAsWord[datum.getDay()]);
									</script>
			                      <h:outputText value=" - #{delegation.time}" escape="false"/></b></td>
			                      
			                      <td style="width: 30%;">&nbsp;#{delegation.awayTeam}</td>
			                      <td style="width: 20%;"></td>
			                      <td style="width: 20%;"><h:outputText value="#{delegation.lineRefereeTwo}" escape="false"/></td>
			                      <td style="width: 20%;"><h:outputText value="#{delegation.carpool}" escape="false"/></td>
			                    </tr> 
			                      <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td>
			                    <tr>
			                    </tr>
                 	 </table>
                </c:forEach>
             </div> 
    	</ui:composition>
	</h:body>
</html>